﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAplicaciones1;
using System.Collections;
namespace DAplicaciones1
{
    public  class OPersistente
    {
       
        private string  _OID;

        private static IPersistencia ip;

        public  IPersistencia Ip
        {
            get { return ip; }
            set { ip = value; }
        }

        public string OID
        {
            get { return _OID; }
            set { _OID = value; }
        }


        public  void agregarse()
        {
            try
            {
                ip.agregar(this);
            }
            catch (Exception e1) 
            {
                throw new System.ArgumentException(e1.Message.ToString());
            }
        }

        public OPersistente() 
        { 

        }
        public  void modificarse()
        {
            try
            {
                ip.modificar(this);
            }
            catch (Exception e1)
            {

            }
        }

        public void eliminarse()
        {
            try
            {
                ip.eliminar(this);
            }
            catch (Exception e1) 
            {
                throw new System.ArgumentException(e1.Message.ToString());
            }
        }

        public  void recuperarse()
        {
            try
            {
                ip.traerDatos(this);
            }
            catch (Exception e1)
            {
                throw new System.ArgumentException(e1.Message.ToString());
            }
        }

        public  ArrayList traerLista()
        {
            try
            {
                return ip.traerLista(this);
            }
            catch (Exception e1)
            {
                throw new System.ArgumentException(e1.Message.ToString());
            }
        }

    }
}
